<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1,minimum-scale=1,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>优惠卷</title>
    <!-- 公共样式 -->
    <link rel="stylesheet" href="../../css/base.css">
    <!-- 公共媒体文件 -->
    <link rel="stylesheet" href="../../css/media.css">
    <!-- 字体图标 -->
    <link rel="stylesheet" href="../../css/font-style.css">
    <!-- 当前文件样式 -->
    <link rel="stylesheet" href="../../css/coupon.css">
    <!-- zepto -->
    <script type='text/javascript' src='../../lib/zepto/zepto.min.js'></script>
    <!-- 模板引擎 -->
    <script type='text/javascript' src='../../lib/template/template.js'></script>

</head>

<body>
    <!-- 面包屑 -->
    <div class="crumbs">
        <a href='../../index.html'>首页</a> > <a href='javascript:;'>优惠卷</a>
    </div>
    <!-- 顶部 -->
    <div class="top">
        <header>
            <!-- 返回上一页 -->
            <a href="javascript:;" class="go-back">
                <span class="icon-arrow_lift"></span>
            </a>
            <!-- 标题 -->
            <div class="title">优惠卷</div>
            <!-- <span>头部</span> -->
            <a href="javascript:;">
                <img src="../../images/header_app.png" alt="">
            </a>
        </header>
    </div>
    <!-- 优惠卷 -->
    <div class="coupon-content">

    </div>
    <!-- 底部 -->
    <footer>
        <div class="foot_tool">
            <a href="javascript:;">登录</a>
            <a href="javascript:;">注册</a>
            <a href="#">返回顶部</a>
        </div>
        <div class="foot_content">
            <a href="javascript:;">手机APP下载
                <span>慢慢买手机版</span>
            </a>
            <span>--掌上比价平台</span>
            <p>m.manmanbuy.com</p>

        </div>
    </footer>
</body>
<!-- 优惠卷模板 -->
<script type='text/template' id="listTmp">
    <ul>
    {{each result as val key}}
        <li>
            <a href="{{val.couponLink}}?id={{val.couponId}}&title={{val.couponTitle}}">
                <div><img src="{{val.couponImg}}" alt=""></div>
                <span>{{val.couponTitle}}</span>
            </a>
        </li>
    {{/each}}
    </ul>
</script>
<script>
    $(function () {
        //获取优惠卷信息
        $.ajax({
            type: "get",
            url: "http://193.112.55.79:9090/api/getcoupon",
            dataType: "json",
            success: function (res) {
                var htmlStr = template('listTmp', res);
                $('.coupon-content').html(htmlStr);
            }
        });

        $('.go-back').tap(function () {
            window.history.back(-1);
        });
    })
</script>

</html>